package org.example.bootvue.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.bootvue.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author YourName
 * @since 2025-07-29
 */
public interface UserMapper extends BaseMapper<User> {
@Select("select * from user where username = #{username}")
    User findByUsername(String username);
    @Insert("insert into user(username,password,create_time,update_time)" +
            " values(#{username},#{password},now(),now())")
    void add(String username, String password);
    @Update("update user set user_pic=#{avatarurl},update_time=now() where id=#{id}")
    void updateAvatar(String avatarurl,Integer id);

    @Update("update user set password=#{md5String},update_time=now() where id=#{id}")
    void updatePwd(String md5String, Integer id);
}
